.TH std::basic_istream::operator= 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_istream::operator= \- std::basic_istream::operator=

.SH Synopsis
   protected:                                                     \fB(1)\fP
   basic_istream& operator=( const basic_istream& rhs ) = delete;
   protected:                                                     \fB(2)\fP \fI(since C++11)\fP
   basic_istream& operator=( basic_istream&& rhs );

   1) The copy assignment operator is protected, and is deleted. Input streams are not
   CopyAssignable.
   2) The move assignment operator exchanges the gcount() values and all data members
   of the base class, except for rdbuf(), with rhs, as if by calling swap(*rhs). This
   move assignment operator is protected: it is only called by the move assignment
   operators of the derived movable input stream classes std::basic_ifstream and
   std::basic_istringstream, which know how to correctly move-assign the associated
   streambuffers.

.SH Parameters

   rhs - the basic_istream object from which to assign to *this

.SH Example


// Run this code

 #include <iostream>
 #include <sstream>

 int main()
 {
     std::istringstream s1;
     s1 = std::istringstream("test"); // OK

 //  std::cin = std::istringstream("test"); // ERROR: 'operator=' is protected
 }
